package com.ymatou.iapi.systemnotice.testcase;

import java.util.List;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.google.gson.JsonObject;
import com.ymatou.iapi.systemnotice.service.NoticeLastCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.database.model.OP_NoticeInfo;
import com.ymttest.database.sqlwapper.YmtCsWapper;
/**
*查询通知明细
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_NoticeLast{
	private static NoticeLastCall NoticeLastCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("查询通知明细");
	}

	@Before
	public void caseUp() {
		NoticeLastCall=new NoticeLastCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(NoticeLastCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_NoticeLast_001() {
		Logger.start(true,"查询最后一条通知明细成功");
		try {
			NoticeLastCall.callService();			
			Logger.verifyEquals("true", NoticeLastCall.getString("Success"), "验证Success");
			JsonObject result = NoticeLastCall.getJsonObject().get("Result").getAsJsonObject();
			OP_NoticeInfo ni = new YmtCsWapper().selectAllNoticeInfo().get(0);
			Logger.verifyEquals(ni.getNoticeId(), result.get("NoticeId").getAsString(), "验证NoticeId");
			Logger.verifyEquals(ni.getBriefTitle(), result.get("BriefTitle").getAsString(), "验证BriefTitle");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}